import Vue from "vue";
import Vuex from "vuex";


Vue.use(Vuex);

export default new Vuex.Store({
    state: {
        address: [
            { "value": "", "address": "99" },
            { "value": "", "address": "0" },
            { "value": "", "address": "0" },
            { "value": "", "address": "0" },
            { "value": "", "address": "0" },
            { "value": "", "address": "0" },
            { "value": "", "address": "0" },
            { "value": "", "address": "0" },
            { "value": "", "address": "0" },
            { "value": "", "address": "0" },
            { "value": "", "address": "0" },
            { "value": "", "address": "0" },
            { "value": "", "address": "0" },
            { "value": "", "address": "0" },
            { "value": "", "address": "0" },
            { "value": "", "address": "0" },
            { "value": "", "address": "0" },
            { "value": "", "address": "0" },
            { "value": "", "address": "0" },
            { "value": "", "address": "0" },
            { "value": "", "address": "0" },
            { "value": "", "address": "0" },
            { "value": "", "address": "0" },
            { "value": "", "address": "0" },
            { "value": "", "address": "0" },
            { "value": "", "address": "0" },
            { "value": "", "address": "0" },
            { "value": "", "address": "0" },
            { "value": "", "address": "0" },
            { "value": "", "address": "0" },
            { "value": "", "address": "0" },


        ],

        objectPath: '', //game/...lightsourec
        objectPathname: '', //属性名lightsource

        ipTips: false, //链接状态的判断
        TextIp: '', //header显示的的ip
        userinputIP: '', //用户输入的内容
        properties: '', //链接传过来的Mapsname
        port: '', //端口号
        Addressprefix: '', //用户输入的物体地址

        postvalue: 0,

        postcolor: '',
    },

    mutations: {
        saveCurrDbSource(state, n) {
            state.address.splice(n.address, 1, n);
            // this.$set(state.address,1,n)
            // state.count +=n
        },

        serObjectPath(state, n) {
            // objectPath 后台返回的数据 数据类型是一个数组
            state.objectPath = n;
            // console.log(state.objectPath);
        },

        setObjectPathname(state, n) {
            state.objectPathname = n
        },

        setipTips(state, n) {
            state.ipTips = n
        },

        setuserinputIP(state, n) {
            state.userinputIP = n
        },

        setTextIp(state, n) {
            state.TextIp = n
        },

        setaddproperties(state, n) {
            state.properties = n
        },

        setport(state, n) {
            state.port = n
        },

        setpostvalue(state, n) {
            state.postvalue = n
        },

        setpostcolor(state, n) {
            state.postcolor = n
        },

        setAddressprefix(state, n) {
            state.Addressprefix = n
        }

    },

    getters: {
        doneTodos: state => {
            return state.address
        }
    }
    
});